package com.firexxx.study.designmodel.factory.simplefactory;

/**
 * @description: TODO
 * @throws:
 * @author: zhuangzhang2
 * @date: 2019/11/11 16:50
 */
public class ProductFactory {

    public IProduct getInstance(String name) throws Exception {
        if (name.equals("man")) {
            return new ManProductImpl();
        } else if (name.equals("woman")) {
            return new WomanProductImpl();
        }

        throw new Exception("不支持的类型");
    }
}